import React from 'react';
import {connect} from 'react-redux'
import { bindActionCreators } from 'redux'

import * as userinfoActions from '../../actions/userinfo'

import Loginstyle from './login.css'
import LoginChil from './login'

class Login extends React.Component{
    constructor(props){
        super(props);
        this.state = {};
    }
    render(){
        return(
            <div className={Loginstyle.container}>
                <div className={Loginstyle.title}>登录界面</div>
                <LoginChil handleLogin={this.handleLog.bind(this)}/>
            </div>
        )
    }
    handleLog(){
        this.props.history.push('/detail');
    }
    componentDidMount(){
       // 地址存入redux
        this.props.actions.setpath({
            path:'ws://192.168.196.91:9502'
        })
    }
}
function mapStateToProps(state){
    return{

    }
}
function mapDispatchToProps(dispatch){
    return{
        actions: bindActionCreators(userinfoActions,dispatch)
    }
}

export default connect(
    mapStateToProps,
    mapDispatchToProps
)(Login)
